<?php
header('Content-Type:text/html;charset=utf-8');
@header("Access-Control-Allow-Origin:*");
header('Access-Control-Allow-Origin:http://127.0.0.1:5500');
$servername="localhost:3306";
$username=$password="root";
$dbname="1907";
$conn=mysqli_connect($servername,$username,$password,$dbname);

$key=$_GET['key'];
$password=$_GET['password'];

$sql="select * from userinfo where username='$key' or telephone='$key'";

$result=mysqli_query($conn,$sql);

$data=mysqli_fetch_array($result);
// echo json_encode($data);
$obj=array();
// echo json_encode($data['password']);

if($data){
    
    if($data['password']==$password){
        $obj['code']=1;
        $obj['msg']="登录成功";
        
        echo json_encode($obj);
    }else{
        $obj['code']=0;
        $obj['msg']="用户名或密码不正确";
        echo json_encode($obj);
    }
    
}else{
    $obj['code']=0;
    $obj['msg']="用户名或密码不正确";
    echo json_encode($obj);
}




?>